<!DOCTYPE html>
<html lang="zh-CN" class="loading">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>记一次对Aria2的折腾 - Skyone-Blog</title>
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="google" content="notranslate" />
    <meta name="keywords" content="Linux,Aria2,极速下载,WebUI,ArinNg,HTTPS,"> 
    <meta name="description" content="Skyone技术博客,本文详细记叙了linux下如何安装、配置、使用Aria2，如何为Aria2安装WebUI:AriaNg,以及如何配置HTTPS"> 
    <meta name="author" content="王志伟"> 
    <link rel="alternative" href="atom.xml" title="Skyone-Blog" type="application/atom+xml"> 
    <link rel="icon" href="/img/favicon.png"> 
    
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">

    
<link rel="stylesheet" href="/css/diaspora.css">

    <!-- 看板娘
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css">
    <script src="/live2d-widget/autoload.js"></script>
    -->
    <!-- MD5 -->
    <script src="/js/md5.min.js"></script>
    <!-- MathJax -->
    
        <script type="text/x-mathjax-config">
        (function () {
            let target = document.getElementsByClassName("content")[0];
            MathJax.Hub.Config({
                tex2jax: {
                    inlineMath:  [ ["$", "$"] ],
                    displayMath: [ ["$$","$$"] ],
                    skipTags: ['script', 'noscript', 'style', 'textarea', 'pre','code','a'],
                    ignoreClass:"class1"
                }
            });
            MathJax.Hub.Queue(["Typeset",MathJax.Hub,target]);
        })();
    </script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>

    
<meta name="generator" content="Hexo 5.3.0"></head>

<body class="loading">
    <span id="config-title" style="display:none">Skyone-Blog</span>
    <div id="loader"></div>
    <div id="single">
    <div id="top" style="display: block;">
    <div class="bar" style="width: 0;"></div>
    <a class="iconfont icon-home image-icon" href="javascript:;" data-url="https://www.skyone.host"></a>
    <div title="播放/暂停" class="iconfont icon-play"></div>
    <h3 class="subtitle">记一次对Aria2的折腾</h3>
    <div class="social">
        <div>
            <div class="share">
                <a title="获取二维码" class="iconfont icon-scan" href="javascript:;"></a>
            </div>
            <div id="qr"></div>
        </div>
    </div>
    <div class="scrollbar"></div>
</div>

    <div class="section">
        <div class="article">
    <div class='main'>
        <h1 class="title">记一次对Aria2的折腾</h1>
        <div class="stuff">
            <span>七月 12, 2021</span>
            
  <ul class="post-tags-list" itemprop="keywords"><li class="post-tags-list-item"><a class="post-tags-list-link" href="/tags/Linux/" rel="tag">Linux</a></li></ul>


        </div>
        <div class="content markdown">
            <blockquote>
<p>原创教程，禁止转载</p>
</blockquote>
<iframe style="border: none; width: 100%; height: 100px" src="https://aplayer.skyone.host/?_=N@502455387"></iframe>

<h2 id="简单介绍"><a href="#简单介绍" class="headerlink" title="简单介绍"></a>简单介绍</h2><p>Aria2作为一个多线程下载器，速度自然不必说，它支持的协议有：HTTP/HTTPS、FTP、SFTP、 BitTorrent 和 Metalink 协议。</p>
<p>首先，看看我的最终成果吧</p>
<p><img src="https://tc-1.oss-cn-hangzhou.aliyuncs.com/blog/post/%E8%AE%B0%E4%B8%80%E6%AC%A1%E5%AF%B9Aria2%E7%9A%84%E6%8A%98%E8%85%BE/%E6%9C%80%E7%BB%88%E6%88%90%E6%9E%9C.png" alt="最终成果"></p>
<h2 id="安装Aria2"><a href="#安装Aria2" class="headerlink" title="安装Aria2"></a>安装Aria2</h2><p>首先当然是安装Aria2，这和在linux下安装别的程序差不多，就是配置、编译、安装嘛~</p>
<h3 id="获取源代码"><a href="#获取源代码" class="headerlink" title="获取源代码"></a>获取源代码</h3><p>去Github找最新版的链接，项目链接：<a target="_blank" rel="noopener" href="https://github.com/aria2/aria2/releases/">Aria2</a></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> 下载</span></span><br><span class="line">wget https://github.com/aria2/aria2/releases/download/release-1.35.0/aria2-1.35.0.tar.gz</span><br><span class="line"><span class="meta">#</span><span class="bash"> 解压</span></span><br><span class="line"><span class="meta">#</span><span class="bash"> .tar.gz 格式用 -zxvf</span></span><br><span class="line"><span class="meta">#</span><span class="bash"> .tar.xz 格式用 -xvf</span></span><br><span class="line">tar -zxvf aria2-1.35.0.tar.gz</span><br><span class="line"><span class="meta">#</span><span class="bash"> 进入文件夹</span></span><br><span class="line">cd aria2-1.35.0</span><br></pre></td></tr></table></figure>
<h3 id="配置-amp-编译-amp-安装"><a href="#配置-amp-编译-amp-安装" class="headerlink" title="配置&amp;编译&amp;安装"></a>配置&amp;编译&amp;安装</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> 创建安装文件夹</span></span><br><span class="line">sudo mkdir -p /usr/local/aria2</span><br><span class="line"><span class="meta">#</span><span class="bash"> 配置安装目录</span></span><br><span class="line">./configure --prefix=/usr/local/aria2</span><br><span class="line"><span class="meta">#</span><span class="bash"> 编译 没有安装编译器的自行百度</span></span><br><span class="line">make</span><br><span class="line"><span class="meta">#</span><span class="bash"> 安装</span></span><br><span class="line">make install</span><br></pre></td></tr></table></figure>
<h2 id="Aria2的配置"><a href="#Aria2的配置" class="headerlink" title="Aria2的配置"></a>Aria2的配置</h2><h3 id="配置文件"><a href="#配置文件" class="headerlink" title="配置文件"></a>配置文件</h3><p>在<code>/etc/aria2</code>创建目录，里面写入一些配置</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo mkdir -p /etc/aria2</span><br><span class="line">sudo vim /etc/aria2/aria2.conf</span><br></pre></td></tr></table></figure>
<p>配置如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br></pre></td><td class="code"><pre><span class="line"># 设置的RPC授权令牌, 取代 --rpc-user 和 --rpc-passwd 选项</span><br><span class="line"># token可以自己随意设置</span><br><span class="line">rpc-secret&#x3D;*********</span><br><span class="line"># 下面是ssl证书，可以先不管</span><br><span class="line"># rpc-private-key&#x3D;</span><br><span class="line"># rpc-certificate&#x3D;</span><br><span class="line"></span><br><span class="line">#允许rpc</span><br><span class="line">enable-rpc&#x3D;true</span><br><span class="line">#允许所有来源, web界面跨域权限需要</span><br><span class="line">rpc-allow-origin-all&#x3D;true</span><br><span class="line">#允许外部访问，false的话只监听本地端口</span><br><span class="line">rpc-listen-all&#x3D;true</span><br><span class="line">#RPC端口, 仅当默认端口被占用时修改</span><br><span class="line">rpc-listen-port&#x3D;13443</span><br><span class="line"></span><br><span class="line">#文件保存路径, 默认为当前启动位置</span><br><span class="line">dir&#x3D;**************</span><br><span class="line">#从会话文件中读取下载任务</span><br><span class="line">input-file&#x3D;&#x2F;etc&#x2F;aria2&#x2F;aria2.session</span><br><span class="line">#在Aria2退出时保存&#96;错误&#x2F;未完成&#96;的下载任务到会话文件</span><br><span class="line">save-session&#x3D;&#x2F;etc&#x2F;aria2&#x2F;aria2.session</span><br><span class="line">#定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0</span><br><span class="line">#save-session-interval&#x3D;60</span><br><span class="line">force-save&#x3D;true</span><br><span class="line">#log&#x3D;&#x2F;aria2log</span><br><span class="line">#log-level&#x3D;error</span><br><span class="line"></span><br><span class="line">#最大同时下载数(任务数), 路由建议值: 3</span><br><span class="line">max-concurrent-downloads&#x3D;5</span><br><span class="line">#断点续传</span><br><span class="line">continue&#x3D;true</span><br><span class="line">#同服务器连接数</span><br><span class="line">max-connection-per-server&#x3D;5</span><br><span class="line">#最小文件分片大小, 下载线程数上限取决于能分出多少片, 对于小文件重要</span><br><span class="line">min-split-size&#x3D;10M</span><br><span class="line">#单文件最大线程数, 路由建议值: 5</span><br><span class="line">split&#x3D;10</span><br><span class="line">#下载速度限制</span><br><span class="line">max-overall-download-limit&#x3D;0</span><br><span class="line">#单文件速度限制</span><br><span class="line">max-download-limit&#x3D;0</span><br><span class="line">#上传速度限制</span><br><span class="line">max-overall-upload-limit&#x3D;0</span><br><span class="line">#单文件速度限制</span><br><span class="line">max-upload-limit&#x3D;0</span><br><span class="line">file-allocation&#x3D;prealloc</span><br></pre></td></tr></table></figure>
<p>按需修改，主要是这两个：<code>rpc-secret</code>、<code>dir</code></p>
<p><code>ESC</code> <code>:wq</code>保存退出</p>
<h3 id="创建会话文件"><a href="#创建会话文件" class="headerlink" title="创建会话文件"></a>创建会话文件</h3><p>位置在<code>input-file</code>和<code>save-session</code>处配置</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo touch /etc/aria2/aria2.session</span><br></pre></td></tr></table></figure>
<h3 id="环境变量"><a href="#环境变量" class="headerlink" title="环境变量"></a>环境变量</h3><p>就一个执行程序，没必要加入环境变量，创建软链接即可：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo ln -s /usr/local/aria2/bin/aria2c /usr/bin/aria2c</span><br></pre></td></tr></table></figure>
<h2 id="Aria2常见命令"><a href="#Aria2常见命令" class="headerlink" title="Aria2常见命令"></a>Aria2常见命令</h2><p>一般下载链接直接接在后面即可</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">aria2c \ </span><br><span class="line">http://autopatchcn.yuanshen.com/client_app/Android/20210609_2758cc87f80c2355/yuanshen_1.6.0_mihoyo.apk</span><br></pre></td></tr></table></figure>
<p>重命名<code>-o</code></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">aria2c -o 原神.apk \</span><br><span class="line">http://autopatchcn.yuanshen.com/client_app/Android/20210609_2758cc87f80c2355/yuanshen_1.6.0_mihoyo.apk</span><br></pre></td></tr></table></figure>
<p>分段下载<code>-x</code> <code>1~5</code></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">aria2c -o 原神.apk -x 4 \ </span><br><span class="line">http://autopatchcn.yuanshen.com/client_app/Android/20210609_2758cc87f80c2355/yuanshen_1.6.0_mihoyo.apk</span><br></pre></td></tr></table></figure>
<p>指定连接数<code>-s</code></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">aria2c -o 原神.apk -x 4 -s 2 \ </span><br><span class="line">http://autopatchcn.yuanshen.com/client_app/Android/20210609_2758cc87f80c2355/yuanshen_1.6.0_mihoyo.apk</span><br></pre></td></tr></table></figure>
<p>同时下载多个文件时 <code>-j</code></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">aria2c -o 原神.apk -x 4 -s 2 -j 10 \ </span><br><span class="line">http://autopatchcn.yuanshen.com/client_app/Android/20210609_2758cc87f80c2355/yuanshen_1.6.0_mihoyo.apk</span><br></pre></td></tr></table></figure>
<p>断点续传<code>-c</code></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">aria2c -o 原神.apk -x 4 -s 2 -j 10 -c \ </span><br><span class="line">http://autopatchcn.yuanshen.com/client_app/Android/20210609_2758cc87f80c2355/yuanshen_1.6.0_mihoyo.apk</span><br></pre></td></tr></table></figure>
<p>验证文件<code>--checksum=md5=*******</code></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">aria2c -o 原神.apk -x 4 -s 2 -j 10 -c --checksum=md5=这里是文件的MD5值 \</span><br><span class="line">http://autopatchcn.yuanshen.com/client_app/Android/20210609_2758cc87f80c2355/yuanshen_1.6.0_mihoyo.apk</span><br></pre></td></tr></table></figure>
<h2 id="安装WebUI"><a href="#安装WebUI" class="headerlink" title="安装WebUI"></a>安装WebUI</h2><p>上面一串使用方法是不是劝退了一堆Linux新手？</p>
<p>没关系，已经有大佬为我们写好了图形界面，来吧，安装</p>
<p>这里使用的是<code>AriaNg</code>，感谢<a target="_blank" rel="noopener" href="https://github.com/mayswind">mayswind</a>大佬拯救我等菜鸟！</p>
<h3 id="启动Aria2RPC"><a href="#启动Aria2RPC" class="headerlink" title="启动Aria2RPC"></a>启动Aria2RPC</h3><p>首先启动Aria2远程调用，让AriaNg能够调用它</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo aria2c --conf-path=/etc/aria2/aria2.conf -D</span><br></pre></td></tr></table></figure>
<p>这样Aria2就会监听一个端口（你<a href="#%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6">上面</a>设置的）</p>
<h3 id="安装AriaNg"><a href="#安装AriaNg" class="headerlink" title="安装AriaNg"></a>安装AriaNg</h3><p>Github项目地址：<a target="_blank" rel="noopener" href="https://github.com/mayswind/AriaNg">AriaNg</a></p>
<p>AriaNg是纯前端项目，安装炒鸡简单呐</p>
<p>前提是你需要Web服务器，比如我用的是<code>Nginx</code></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> 创建目录</span></span><br><span class="line">sudo mkdir -p /var/www/ariang/</span><br><span class="line">cd /var/www/ariang/</span><br><span class="line"><span class="meta">#</span><span class="bash"> 下载，最新版去Github找</span></span><br><span class="line">sudo wget https://github.com/mayswind/AriaNg/releases/download/1.2.2/AriaNg-1.2.2.zip</span><br><span class="line"><span class="meta">#</span><span class="bash"> 解压，删除zip文件</span></span><br><span class="line">sudo unzip AriaNg-1.2.2.zip</span><br><span class="line">sudo rm AriaNg-1.2.2.zip</span><br></pre></td></tr></table></figure>
<p>安装完成！</p>
<h3 id="配置Nginx"><a href="#配置Nginx" class="headerlink" title="配置Nginx"></a>配置Nginx</h3><p>在<code>/etc/nginx/conf.d/</code>创建<code>ariang.conf</code>，当然，名称任取</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /etc/nginx/conf.d/ariang.conf</span><br></pre></td></tr></table></figure>
<p>内容如下（这里是http的，https后面在讲）</p>
<figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="section">server</span> &#123;</span><br><span class="line">    <span class="attribute">listen</span>       <span class="number">80</span>;</span><br><span class="line">    <span class="attribute">server_name</span>  ng.pi.skyone.host; <span class="comment"># 改成你的域名/IP</span></span><br><span class="line">    <span class="attribute">root</span> /var/www/ariang;           <span class="comment"># 刚刚创建的目录</span></span><br><span class="line"></span><br><span class="line">    <span class="attribute">location</span> / &#123;</span><br><span class="line">        <span class="attribute">index</span> index.html index.htm index.php;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>重启Nginx</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo systemctl restart nginx</span><br></pre></td></tr></table></figure>
<p><strong>完成，快打开你的域名或IP访问吧~</strong></p>
<h3 id="配置AriaNg"><a href="#配置AriaNg" class="headerlink" title="配置AriaNg"></a>配置AriaNg</h3><p>打开你的域名或IP你应该看到：</p>
<p><img src="https://tc-1.oss-cn-hangzhou.aliyuncs.com/blog/post/%E8%AE%B0%E4%B8%80%E6%AC%A1%E5%AF%B9Aria2%E7%9A%84%E6%8A%98%E8%85%BE/%E9%85%8D%E7%BD%AEAriaNg01.png" alt="配置AriaNg01"></p>
<blockquote>
<p><strong>不要尝试打开我的这个域名，这个是部署在专有虚拟网络里的，你打不开的！</strong></p>
<p><strong>不要尝试打开我的这个域名，这个是部署在专有虚拟网络里的，你打不开的！</strong></p>
<p><strong>不要尝试打开我的这个域名，这个是部署在专有虚拟网络里的，你打不开的！</strong></p>
</blockquote>
<p>当然，目前你还没有配置SSL，链接左边也没有小锁，这个下文再教</p>
<img src="https://tc-1.oss-cn-hangzhou.aliyuncs.com/blog/post/%E8%AE%B0%E4%B8%80%E6%AC%A1%E5%AF%B9Aria2%E7%9A%84%E6%8A%98%E8%85%BE/%E9%85%8D%E7%BD%AEAriaNg02.png" alt="配置AriaNg02" style="zoom:50%;" />

<p>填写如下信息，你的可能和我稍有不同</p>
<p>地址填你安装Aria2的设备的域名或IP，填写端口（你<a href="#%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6">上面</a>设置的）</p>
<p>协议选<code>HTTP</code>，我的配置了HTTPS所以不一样</p>
<p>Aria2设置了密码就填写密钥</p>
<img src="https://tc-1.oss-cn-hangzhou.aliyuncs.com/blog/post/%E8%AE%B0%E4%B8%80%E6%AC%A1%E5%AF%B9Aria2%E7%9A%84%E6%8A%98%E8%85%BE/%E9%85%8D%E7%BD%AEAriaNg03.png" alt="配置AriaNg03" style="zoom: 50%;" />

<p>刷新以应用修改</p>
<h3 id="完成"><a href="#完成" class="headerlink" title="完成"></a>完成</h3><p>本教程到此基本可以结束了，后面的主要针对想配置HTTPS的强迫症患者</p>
<h2 id="使用HTTPS"><a href="#使用HTTPS" class="headerlink" title="使用HTTPS"></a>使用HTTPS</h2><blockquote>
<p>想使用HTTPS，你需要域名和对应的证书，这部分内容不在本教程范围内，如果你没有了解过相关内容建议先百度或放弃HTTPS，这并不影响使用！</p>
<p>继续看下去的想必都有Linux基础，一些基本的常识我就跳过了</p>
</blockquote>
<p>现在假设你已经有了域名和证书，证书放在<code>/etc/nginx/cert</code>文件夹里</p>
<p>为了方便<del>（懒）</del>我以我的域名为例（反正你们打不开~~）</p>
<h3 id="修改Aria2配置"><a href="#修改Aria2配置" class="headerlink" title="修改Aria2配置"></a>修改Aria2配置</h3><p>指定证书位置即可</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /etc/aria2/aria2.conf</span><br></pre></td></tr></table></figure>
<p>只需要修改这两项：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">rpc-private-key&#x3D;&#x2F;etc&#x2F;nginx&#x2F;cert&#x2F;ng.pi.skyone.host.key # 证书私钥</span><br><span class="line">rpc-certificate&#x3D;&#x2F;etc&#x2F;nginx&#x2F;cert&#x2F;ng.pi.skyone.host.pem # 证书公钥</span><br></pre></td></tr></table></figure>
<p>查看Aria2进程，kill掉，重启</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">sudo ps -ef | grep aria2</span><br><span class="line">sudo kill 对应的pid</span><br><span class="line">sudo aria2c --conf-path=/etc/aria2/aria2.conf -D </span><br></pre></td></tr></table></figure>
<h3 id="修改Nginx配置"><a href="#修改Nginx配置" class="headerlink" title="修改Nginx配置"></a>修改Nginx配置</h3><p>就是配置SSL嘛？</p>
<p>没有这么简单，这里稍微有一个小坑：</p>
<blockquote>
<p>HTTPS浏览器之认443端口，而我们不可能让Aria2独占这么宝贵的443端口，因此只能<strong>反向代理</strong>了</p>
<p>而且我们完全可以让AriaNg和Aria2RPC使用同一个域名，这样能少配置一个SSL，还能避免跨域问题，嘿嘿嘿我真机智~</p>
</blockquote>
<p>修改<code>/etc/nginx/conf.d/ariang.conf</code></p>
<p>内容如下，请根据情况修改：</p>
<figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line"><span class="section">server</span> &#123;</span><br><span class="line">    <span class="attribute">listen</span>       <span class="number">443</span> ssl;</span><br><span class="line">    <span class="attribute">server_name</span>  ng.pi.skyone.host; <span class="comment"># 你的域名</span></span><br><span class="line">    <span class="attribute">root</span> /var/www/ariang;</span><br><span class="line"></span><br><span class="line">    <span class="attribute">ssl_certificate</span>     /etc/nginx/cert/ng.pi.skyone.host.pem; <span class="comment"># 证书私钥</span></span><br><span class="line">    <span class="attribute">ssl_certificate_key</span> /etc/nginx/cert/ng.pi.skyone.host.key; <span class="comment"># 证书公钥</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="attribute">ssl_session_timeout</span> <span class="number">5m</span>;</span><br><span class="line">    <span class="attribute">ssl_ciphers</span> ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;</span><br><span class="line">    <span class="attribute">ssl_protocols</span> TLSv1 TLSv1.<span class="number">1</span> TLSv1.<span class="number">2</span>;</span><br><span class="line">    <span class="attribute">ssl_prefer_server_ciphers</span> <span class="literal">on</span>;</span><br><span class="line"></span><br><span class="line">    <span class="attribute">location</span> /jsonrpc &#123;</span><br><span class="line">        <span class="attribute">proxy_pass</span> http://localhost:13443/jsonrpc;</span><br><span class="line">        <span class="attribute">proxy_redirect</span> http:// https://;</span><br><span class="line">        <span class="attribute">proxy_set_header</span> Host $host:<span class="number">443</span>;</span><br><span class="line">        <span class="attribute">proxy_set_header</span> Upgrade $http_upgrade;</span><br><span class="line">        <span class="attribute">proxy_set_header</span> Connection upgrade;</span><br><span class="line">        <span class="attribute">proxy_set_header</span> Accept-Encoding gzip;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="attribute">location</span> / &#123;</span><br><span class="line">        <span class="attribute">index</span> index.html index.htm index.php;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> 重启Nginx</span></span><br><span class="line">sudo systemctl restart nginx</span><br></pre></td></tr></table></figure>
<h3 id="配置AriaNg-1"><a href="#配置AriaNg-1" class="headerlink" title="配置AriaNg"></a>配置AriaNg</h3><p>这个和之前一样，照着我的填吧、、</p>
<img src="https://tc-1.oss-cn-hangzhou.aliyuncs.com/blog/post/%E8%AE%B0%E4%B8%80%E6%AC%A1%E5%AF%B9Aria2%E7%9A%84%E6%8A%98%E8%85%BE/%E9%85%8D%E7%BD%AEAriaNg03.png" alt="配置AriaNg03" style="zoom: 50%;" />

<h2 id="收工"><a href="#收工" class="headerlink" title="收工"></a>收工</h2><p>好啦，去享受吧</p>
<p>与这篇文章相关的内容，例如：</p>
<ul>
<li>白嫖免费泛域名证书</li>
<li>Zerotier组网</li>
</ul>
<p>留待以后再写，不说了，学期末，学高数去了、、</p>

            <!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->
            <audio id="audio" loop="1" preload="auto" controls="controls" data-autoplay="false">
                <source type="audio/mpeg" src="">
            </audio>
            
                <ul id="audio-list" style="display:none">
                    
                        
                            <li title='0' data-url='https://tc.skyone.host/blog/music/%E6%B4%9B%E5%A4%A9%E4%BE%9D%20-%20%E5%A4%9C%E8%88%AA%E6%98%9F.flac'></li>
                        
                    
                        
                            <li title='1' data-url='https://tc.skyone.host/blog/music/%E6%B4%9B%E5%A4%A9%E4%BE%9D%20-%20%E8%8C%89%E8%8E%89%E8%8A%B1.mp3'></li>
                        
                    
                        
                            <li title='2' data-url='https://tc.skyone.host/blog/music/%E8%B5%A4%E7%BE%BD%20-%20%E4%B8%87%E5%8F%A4%E7%94%9F%E9%A6%99.flac'></li>
                        
                    
                        
                            <li title='3' data-url='https://tc.skyone.host/blog/music/%E6%B4%9B%E5%A4%A9%E4%BE%9D%20-%20%E4%B8%BA%E8%B0%81%E8%80%8C%E4%B8%BA.mp3'></li>
                        
                    
                        
                            <li title='4' data-url='https://tc.skyone.host/blog/music/%E4%B9%90%E6%AD%A3%E7%BB%AB%20-%20Faded.mp3'></li>
                        
                    
                        
                            <li title='5' data-url='https://tc.skyone.host/blog/music/bilibili2018%20-%20%E8%87%B3%E5%B0%8A%E9%A9%AC%E7%94%B2.flac'></li>
                        
                    
                </ul>
            
        </div>
        
    <div id='gitalk-container' class="comment link"
		data-enable='true'
        data-ae='true'
        data-ci='d5e197ef955b7f3268e5'
        data-cs='7d4feed7a179ad28943b0865b7970814073145ad'
        data-r='blog-gitalk'
        data-o='skyone-wzw'
        data-a='skyone-wzw'
        data-d='false'
    >查看评论</div>


    </div>
    
        <div class='side'>
			<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%AE%80%E5%8D%95%E4%BB%8B%E7%BB%8D"><span class="toc-number">1.</span> <span class="toc-text">简单介绍</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85Aria2"><span class="toc-number">2.</span> <span class="toc-text">安装Aria2</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%8E%B7%E5%8F%96%E6%BA%90%E4%BB%A3%E7%A0%81"><span class="toc-number">2.1.</span> <span class="toc-text">获取源代码</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE-amp-%E7%BC%96%E8%AF%91-amp-%E5%AE%89%E8%A3%85"><span class="toc-number">2.2.</span> <span class="toc-text">配置&amp;编译&amp;安装</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Aria2%E7%9A%84%E9%85%8D%E7%BD%AE"><span class="toc-number">3.</span> <span class="toc-text">Aria2的配置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6"><span class="toc-number">3.1.</span> <span class="toc-text">配置文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E4%BC%9A%E8%AF%9D%E6%96%87%E4%BB%B6"><span class="toc-number">3.2.</span> <span class="toc-text">创建会话文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F"><span class="toc-number">3.3.</span> <span class="toc-text">环境变量</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Aria2%E5%B8%B8%E8%A7%81%E5%91%BD%E4%BB%A4"><span class="toc-number">4.</span> <span class="toc-text">Aria2常见命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85WebUI"><span class="toc-number">5.</span> <span class="toc-text">安装WebUI</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%90%AF%E5%8A%A8Aria2RPC"><span class="toc-number">5.1.</span> <span class="toc-text">启动Aria2RPC</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85AriaNg"><span class="toc-number">5.2.</span> <span class="toc-text">安装AriaNg</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AENginx"><span class="toc-number">5.3.</span> <span class="toc-text">配置Nginx</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AEAriaNg"><span class="toc-number">5.4.</span> <span class="toc-text">配置AriaNg</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%8C%E6%88%90"><span class="toc-number">5.5.</span> <span class="toc-text">完成</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8HTTPS"><span class="toc-number">6.</span> <span class="toc-text">使用HTTPS</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BF%AE%E6%94%B9Aria2%E9%85%8D%E7%BD%AE"><span class="toc-number">6.1.</span> <span class="toc-text">修改Aria2配置</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BF%AE%E6%94%B9Nginx%E9%85%8D%E7%BD%AE"><span class="toc-number">6.2.</span> <span class="toc-text">修改Nginx配置</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AEAriaNg-1"><span class="toc-number">6.3.</span> <span class="toc-text">配置AriaNg</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%94%B6%E5%B7%A5"><span class="toc-number">7.</span> <span class="toc-text">收工</span></a></li></ol>	
        </div>
    
</div>


    </div>
</div>
</body>

<script src="//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>


<script src="//lib.baomitu.com/jquery/1.8.3/jquery.min.js"></script>
<script src="/js/plugin.js"></script>
<script src="/js/typed.js"></script>
<script src="/js/skyone.min.js"></script>


<link rel="stylesheet" href="/photoswipe/photoswipe.css">
<link rel="stylesheet" href="/photoswipe/default-skin/default-skin.css">


<script src="/photoswipe/photoswipe.min.js"></script>
<script src="/photoswipe/photoswipe-ui-default.min.js"></script>


<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>
    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">
        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>
        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">
            <div class="pswp__top-bar">
                <!--  Controls are self-explanatory. Order can be changed. -->
                <div class="pswp__counter"></div>
                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
                <button class="pswp__button pswp__button--share" title="Share"></button>
                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                      <div class="pswp__preloader__cut">
                        <div class="pswp__preloader__donut"></div>
                      </div>
                    </div>
                </div>
            </div>
            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div> 
            </div>
            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>
            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>
            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>
        </div>
    </div>
</div>




</html>
